//
//  NSDictionary+NSDictionaryAddition.m
//  wAudioShare
//
//  Created by Anson on 14-4-4.
//  Copyright (c) 2014年 赵帅. All rights reserved.
//

#import "NSDictionaryAddition.h"

@implementation NSDictionary (NSDictionaryAddition)

- (NSString *)getStringValForKey:(NSString *)key {

    id data = [self objectForKey:key];
    if (data) {
        if ([data isKindOfClass:[NSString class]]) {
            return data;
        }else if ([data isKindOfClass:[NSNumber class]]) {
            return [data stringValue];
        }
    }
    return nil;
}

- (NSInteger)getIntegerValForKey:(NSString *)key
{
    id data = [self objectForKey:key];
    if (data) {
        if ([data isKindOfClass:[NSString class]]) {
            NSString *s = data;
            return [s integerValue];
        }else if ([data isKindOfClass:[NSNumber class]]) {
            NSNumber *s = data;
            return [s integerValue];
        }
    }
    return NSIntegerMin;
}

- (BOOL)getBooleanValForKey:(NSString *)key
{
    id data = [self objectForKey:key];
    if (data) {
        if ([data isKindOfClass:[NSString class]]) {
            NSString *s = data;
            return [s boolValue];
        }else if ([data isKindOfClass:[NSNumber class]]) {
            NSNumber *s = data;
            return [s boolValue];
        }
    }
    return NSIntegerMin;
}

@end
